home *** CD-ROM | disk | FTP | other *** search
/ ShareWare OnLine 2 / ShareWare OnLine Volume 2 (CMS Software)(1993).iso / os2 / pmdsk.zip / INSTALL.CMD < prev    next >
OS/2 REXX Batch file  |  1993-02-23  |  2KB  |  74 lines

  1. /* INSTALL Version 1.0 (c) Bernd Wetzel 1993                                  */
  2. /* procedure to install PM Diskcopy on the harddisk                           */
  3. CALL RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  4. CALL SysLoadFuncs 
  5.  
  6. title = 'Installation of PM Diskcopy'
  7. targetpath = 'C:\PMDSKCPY'
  8. file.0 = 5
  9. file.1 = 'PMDSKCPY.EXE'
  10. file.2 = 'PMDSKCPY.HLP'
  11. file.3 = 'README.DOC'
  12. file.4 = 'HISTORY.DOC'
  13. file.5 = 'REGISTER.DOC'
  14.  
  15. /* Intro, ask where to install PM Diskcopy                                    */
  16. CALL SysCls
  17. SAY 
  18. SAY ''title''
  19. SAY 'By default PM Diskcopy will be installed to' targetpath'.'
  20. SAY 'Enter "Y" to confirm, "N" to exit or enter a new path (e.g. D:\TOOLS) where PM Diskcopy should be installed.'
  21. SAY 'Press <ENTER> when ready.'
  22. PULL answer .
  23. IF (answer <> 'Y') THEN DO
  24.   IF (answer = 'N') THEN EXIT 1
  25.   targetpath = answer
  26. END
  27.  
  28. /* Check for all the files in the current directory                           */
  29. filemissing = 0
  30. DO i = 1 TO file.0
  31.   search = file.i
  32.   sysrc = SysFileTree(search, ret, 'FO')
  33.   IF (ret.0 = 0 | sysrc <> 0) THEN DO
  34.     SAY file.i 'is missing in the current directory'
  35.     filemissing = 1
  36.   END
  37. END
  38. IF filemissing = 1 THEN DO
  39.   EXIT 1
  40. END
  41.  
  42. /* Now create the target directory                                            */
  43. sysrc = SysMkDir(targetpath)
  44. IF (sysrc <> 0) THEN DO
  45.   SAY 'Directory' targetpath 'could not be created !'
  46.   IF (sysrc = 5) THEN SAY 'Directory already exists !'
  47.   SAY title 'will be terminated.'
  48.   EXIT 3
  49. END
  50.  
  51. /* Now copy all the files to the target directory                             */
  52. SAY 'PM Diskcopy will be installed to 'targetpath' ...'
  53. DO i = 1 TO file.0
  54.   target = targetpath || '\' || file.i
  55.   '@COPY' file.i '/B' target '/V >nul 2>nul'
  56.   IF (rc <> 0) THEN DO
  57.     SAY 'File' file.i 'could not be copied to' targetpath '!'
  58.     SAY title 'will be terminated.'
  59.     EXIT 3
  60.   END
  61. END
  62.  
  63. /* Now create an object on the desktop                                        */
  64. SAY 'PM Diskcopy will be created as object on the desktop ...'
  65. sysrc = SysCreateObject('WPProgram','PM Diskcopy','<WP_DESKTOP>','EXENAME='|| targetpath || '\' || file.1';PROGTYPE=PM;STARTUPDIR='||targetpath)
  66. IF (sysrc <> 1) THEN DO
  67.   SAY 'Object could not be created on the desktop !'
  68.   SAY title 'will be terminated.'
  69.   EXIT 4
  70. END
  71.  
  72. SAY 'PM Diskcopy was successfully installed to 'targetpath'.'
  73. EXIT 0
  74.